package ru.evga.gwt.lib.common.client.view;

import ru.evga.gwt.lib.common.client.domain.BaseEntityDto;
import ru.evga.gwt.lib.common.client.ui.editor.ISaveEntityCallback;

import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.view.client.HasData;


/**
 * A view of a list of {@link BaseEntityDto}s, which declares which properties it
 * is able to display.
 * <p>
 * It is expected that such views will typically (eventually) be defined largely
 * in ui.xml files which declare the properties of interest, which is why the
 * view is a source of a property set rather than a receiver of one.
 * 
 * @param <P>
 *            the type of the records to display
 */
public interface IEntityListView<P extends BaseEntityDto>
    extends IsWidget
{
    /**
     * Implemented by the owner of a RecordTableView.
     * 
     * @param <R>
     *            the type of the records to display
     */
    interface Delegate<R extends BaseEntityDto>
    {
        void onCreateClicked();

        void onShowDetails(R item);

        void onEditClicked(R item);

        void onRemoveClicked(R item);
        
        void onSelected(R item);
        
        void applyFilter();
    }

    HasData<P> asHasData();

    /**
     * Sets the delegate.
     */
    void setDelegate(Delegate<P> delegate);
}
